// const express = require('express')
// const app = express()
// app.use(
//     express.urlencoded({
//         extended: true
//     })
// )
// app.use(express.json())
// app.post('/cards', (req, res) => {
//     console.log(req.body)
// })

const http = require('https')
const port=10086
const hostname='127.0.0.1'
const server = http.createServer((req, res) => {
    let data=''
    let resText='this is text from httpserver.'
    req.on('data', chunk => {
        data+=chunk
        console.log(`可用数据：${chunk}`)
    })
    res.statusCode = 200
    res.setHeader('Content-Type', 'application/json')
    res.setHeader('Content-Length', resText.length)
    res.write(resText)
    res.end()
})

server.listen(port, hostname, () => {
    console.log(`服务器运行在 http://${hostname}:${port}/`)
})